package com.usian.admin.controller.v1;

import com.usian.admin.service.NewsAuthService;
import com.usian.apis.admin.AdChannelControllerApis;
import com.usian.apis.admin.NewsAuthControllerApis;
import com.usian.model.admin.dtos.NewsAuthDto;
import com.usian.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("api/v1/news_auth")
public class NewsAuthController implements NewsAuthControllerApis {

    @Autowired
    private NewsAuthService newsAuthServiceI;


    @Override
    @PostMapping("list")
    public ResponseResult findList(@RequestBody NewsAuthDto newsAuthDto) {

        return newsAuthServiceI.findList(newsAuthDto);
    }

    @Override
    @GetMapping("one/{id}")
    public ResponseResult findOne(@PathVariable Integer id) {
        return newsAuthServiceI.findOne(id);
    }

    @Override
    @PostMapping("auth_pass")
    public ResponseResult authPass(@RequestBody NewsAuthDto newsAuthDto) {
        return newsAuthServiceI.newsAuth(newsAuthDto, 1);
    }

    @Override
    @PostMapping("auth_fail")
    public ResponseResult authFail(@RequestBody NewsAuthDto newsAuthDto) {
        return newsAuthServiceI.newsAuth(newsAuthDto, 0);
    }
}
